<template>
    <div class="buttonGroup">
        <el-button @click="save">提 交</el-button>
        <el-button @click="toSetting">跳转至基础设置 </el-button>
    </div>
    <ts-code-editor v-model="data" mode="xml" :height="700"></ts-code-editor>
    <!-- <editor-markdown></editor-markdown> -->
</template>
<script setup>
import { ref,onMounted } from 'vue'
import tsCodeEditor from '@/components/scCodeEditor/index.vue'
import API from '@/api/model/report.js'
import { useRoute,useRouter } from 'vue-router'
const route = useRoute();
const router  = useRouter()
const data = ref()
onMounted(() => {
	getInit()
})

const getInit = async () => {
    console.log(route.query.fileName)
	let res = await API.getReportFileContent.post({ fileName: route.query.fileName })
	console.log(res)
	if (res.code == 200) {
		data.value = res.data
	}
}
const save = async ()=>{
    let res =await API.saveReportFileContent.post({ fileName: route.query.fileName ,fileContent:data.value})
}
const toSetting = () =>{
    router.push({
        path:'/reportSetting',
        query: { fileName: route.query.fileName}
    })
}
</script>
<style scoped>
.buttonGroup {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    height: 48px;
    justify-content: flex-end;
    margin-bottom: 12px;
    padding: 10px 16px;
    font-size: 12px;
    list-style-type: none;
    text-align: left;
    background-color: #FFFFFF;
}
</style>